<?php if ( ! defined('DIR')) exit('No direct script access allowed');

	class Router{
	
		private $className;
		
		private $method;
		
		private $parameters = array();
		
		public function __construct()
		{
			
		}
	
		public function url_parse(){
		
			if(getConfig('static_route')==1){
				$query=$_SERVER['REQUEST_URI'];
			
				if(strpos($query,'?'))
				{
					// localhost/index.php?index/index
					$query=substr($query,strpos($query,'?')+1);
			
					$query=explode('/',$query);
					$this->className=$query[0]?$query[0]."Control":"indexControl";
					$this->method=$query[1]?$query[1]:"index";
					$this->parameters=array_slice($query,2);
				}else{
					// localhost/index.php 
					$this->className="indexControl";
					$this->method="index";
					$this->parameters=array();
				}
			}else{
				
				$control = @$_GET[c] ? @$_GET[c]: @$_GET[C];
				$control = !isset($control) ? "indexControl" : $control."Control";
				$method = @$_GET[m] ? @$_GET[m] : @$_GET[M];
				$method = !isset($method) ? "index" : $method;
				$query = explode('&',$_SERVER['REQUEST_URI']);
				$query = array_slice($query,2);
				$this->className=$control;
				$this->method=$method;
				$this->parameters=$query;
				
			}
		}	
		
		public function fetch_class(){
			return $this->className;
		}
		
		public function fetch_method(){
			return $this->method;
		}
		
		public function fetch_parameters(){
			return $this->parameters;
		}
		
		
	}	
